<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:68:"/www/wwwroot/xunda-college/application/atxunda/view/user/answer.html";i:1702270286;s:69:"/www/wwwroot/xunda-college/application/atxunda/view/index/header.html";i:1700617178;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="__PUBLIC__css/pintuer.css?v=1.0">
<link rel="stylesheet" href="__PUBLIC__admin/admin.css">
<link rel="stylesheet" href="__PUBLIC__layui/css/layui.css">
<script src="__PUBLIC__js/jquery.js"></script>
<script src="__PUBLIC__js/pintuer.js"></script>
<script src="__PUBLIC__js/cookie.js"></script>
<script src="__PUBLIC__layui/layui.js"></script>
</head>
<style type="text/css">
	.refresh{width: 20px;height: 20px;float: right;margin:10px 20px;display: block;}
</style>
</head>
<?php if(request()->controller() != 'Index'): ?><img src="__PUBLIC__images/refresh.png" class="refresh" title="刷新"><?php endif; ?>
<script type="text/javascript">
	$('.refresh').click(function(){layer.msg('刷新中……');window.location.reload();})
</script>
<script type="text/javascript">
	function openwinx(url,name,w,h) {
		if(!w) w=screen.width-4;
		if(!h) h=screen.height-95;
		window.open(url,name,"width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
	}
</script>
<block name="css">
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/UEditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/UEditor/ueditor.all.min.js"> </script>
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/UEditor/lang/zh-cn/zh-cn.js"></script>
</block>
<script type="text/javascript" src="__PUBLIC__admin/UEditor/third-party/SyntaxHighlighter/shCore.js"></script>
<link rel="stylesheet" href="__PUBLIC__admin/UEditor/third-party/SyntaxHighlighter/shCoreDefault.css">
<script type="text/javascript">
	SyntaxHighlighter.all();
</script>
<style type="text/css">.editor_content{display: none;}</style>
<body>
	<div class="panel admin-panel margin-top" id="add">
		<div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 问答点评</strong></div>
		<div class="body-content">
			<div class="form-x" >
				<div class="form-group">
					<div class="label">
						<label>课程：</label>
					</div>
					<div class="label" style="width:5%;overflow:inherit">
						<label><?php echo $data['nav_name']; ?><br/><?php echo $data['type_name']; ?><br/><?php echo $data['s_name']; ?><br/><?php echo $data['course_name']; ?></label>
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>学生身份：</label>
					</div>
					<div class="label" style="width:5%;overflow:inherit">
						<label><?php echo $data['know_nickname']; ?><br/><?php echo $data['know_phone']; ?><br/><?php echo returnUserDispose($data['user_id']); ?></label>
						<div class="tips"></div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>学生问答：</label>
					</div>
					<div class="field">
						<?php echo $data['content']; ?>
						<div class="col-md-8 col-md-offset-2"><a class="btn btn-success btn-sm pull-right" data-id="<?php echo $data['id']; ?>">修改</a></div>
					</div>
					<div class="editor_content"><?php echo $data['content']; ?></div>
				</div>
				<?php foreach($answer as $a): ?>
				<div class="form-group">
					<div class="label">
						<label><?php if($a['user_id'] == 0): ?>老师点评<?php else: ?>学生追问<?php endif; ?>：</label>
					</div>
					<div class="field">
						<?php echo $a['content']; ?>
						<div class="col-md-8 col-md-offset-2"><a class="btn btn-success btn-sm pull-right" data-id="<?php echo $a['id']; ?>">修改</a></div>
					</div>
					<div class="editor_content"><?php echo $a['content']; ?></div>
				</div>
				<?php endforeach; ?>
			</div>
			<form method="post" class="form-x" action="">
				<div class="form-group">
					<div class="label">
						<label>是否解决：</label>
					</div>
					<div class="field">
						<div class="button-group radio">
							<label class="button <?php if($data['answer'] == 1): ?> active <?php endif; ?>">
								<span class="icon icon-check"></span>
								<input name="answer" value="1" type="radio" <?php if($data['answer'] == 1): ?> checked="checked" <?php endif; ?>>是
							</label>
							<label class="button <?php if($data['answer'] == 0): ?> active <?php endif; ?>">
								<span class="icon icon-times"></span>
								<input name="answer" value="0" type="radio" <?php if($data['answer'] == 0): ?> checked="checked" <?php endif; ?>>否
							</label>
						</div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label>点评：</label>
					</div>
					<div class="field">
						<textarea name="content" id="editor" style="width:845px; height:460px;"></textarea>
						<div class="tips">点评</div>
					</div>
				</div>
				<div class="form-group">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
					</div>
				</div>
				<input type="hidden" name="course_id" value="<?php echo $data['course_id']; ?>">
				<input type="hidden" name="id" value="<?php echo $data['id']; ?>">
			</form>
		</div>
	</div>
	<script>
		var ue = UE.getEditor('editor');
		var num = 0;
		var ueChange = [];
		$(document).on('click','.pull-right',function(){
			var id = $(this).data('id');
			var content = $(this).parent().parent().next().html();
			$(this).parent().parent().html('<textarea name="choices[]" id="editor'+num+'" class="editor1" data-sort="'+num+'" style="width:529px; height:166px;">'+content+'</textarea><div class="col-md-8 col-md-offset-2"><a class="btn btn-success btn-sm pull-submit" data-id="'+id+'" data-num="'+num+'">提交</a><a class="btn btn-success btn-sm pull-cancel" data-id="'+id+'" style="background-color:#e20d0d">取消</a></div>');
			ueChange = editors(num);
			num++;
		});
		$(document).on('click','.pull-cancel',function(){
			var id = $(this).data('id');
			var content = $(this).parent().parent().next().html();
			$(this).parent().parent().html(content+'<div class="col-md-8 col-md-offset-2"><a class="btn btn-success btn-sm pull-right" data-id="'+id+'">修改</a></div>');
		});
		$(document).on('click','.pull-submit',function(){
			var _ts = $(this);
			var id = $(this).data('id');
			var nums = $(this).data('num');
			var content = ueChange[''+nums+''].getContent();
			$.ajax({
				url:'/atxunda/user/changeQuestion',
				data:{'id':id,'content':content},
				type:"post",
				success:function(){
					_ts.parent().parent().next().html(content);
					_ts.parent().parent().html(content+'<div class="col-md-8 col-md-offset-2"><a class="btn btn-success btn-sm pull-right" data-id="'+id+'">修改</a></div>');
				}
			})
		});
		function editors(sort = ''){
			var ues = UE.getEditor('editor'+sort, {
				toolbars: [
					[
						'source', //源代码
						'bold', //加粗
						'italic', //斜体
						'underline', //下划线
						'subscript', //下标
						'superscript', //上标
						'removeformat', //清除格式
						'unlink', //取消链接
						'insertcode', //代码语言
						'fontfamily', //字体
						'fontsize', //字号
						'simpleupload', //单图上传
						'insertimage', //多图上传
						'link', //超链接
						'forecolor', //字体颜色
						'backcolor', //背景色
						'insertorderedlist', //有序列表
						'insertunorderedlist', //无序列表
						'imagecenter', //居中
						'inserttable', //插入表格
						'drafts', // 从草稿箱加载
					]
				],
				autoHeightEnabled: true,
				autoFloatEnabled: true
			});
			ueChange[''+sort+''] = ues;
			return ueChange;
		}
	</script>
</body></html>